package com.nbstar.film.spider.filter;

public class ReplaceBracketsNameFilter implements IMediaNameFilter {
    @Override
    public String getFilterName() {
        return "BAIKE-FILTER";
    }


    @Override
    public String parseName(String name) {
        int s = name.indexOf("（");
        int e = name.indexOf("）");
        String result = name;
        if (s>=0 && e>s) {
            String bracket = name.substring(s, e + 1);
            result = name.replaceAll(bracket, "").trim();
        }


        s = name.indexOf("(");
        e = name.indexOf(")");
        if (s>=0 && e>s) {
            String bracket = name.substring(s, e + 1);
            result = result.replaceAll(bracket, "").trim();
        }

        return result;
    }
}
